

#A Tradeoff Between Mental Well-Being and Political Mobilization

#Visualizations of AMCE

library(ggplot2)
library(scales)
library(stargazer)
library(mediation)


####################################################
# Mediation Visualizations for Study 1

#Using results from Stata mediation analysis.


data.summary <- as.data.frame(cbind(c(-.7434749,-1.963827,-2.707302),c(-1.675636,-4.71225,-5.399544),c(-.0659691,.5908234,-.0603427)))
colnames(data.summary) <- c("mean", "lower", "upper")
data.summary$name <- c("ACME", "ADE", "Total")
data.summary$name <- factor(data.summary$name, levels=c("Total", "ADE", "ACME"))


# % of Tot Eff mediated  |  .2701289    


ggplot(data.summary,
       aes(x=mean, y=name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=lower, xmax=upper, height=0.1), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Mediation Analysis: Anxiety") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Political Engagement") +
  ylab("") +
  scale_x_continuous(limits=c(-6, 1),breaks=seq(-6, 1, by=1)) +
  theme(text = element_text(size=12))


# Robustness check to rule out anger as alternative mediator
# Using results from Stata mediation analysis.


data.summary <- as.data.frame(cbind(c(-.0070524,-2.502229,-2.509281),c(-1.128184,-4.966655,-5.148618),c(1.072785,-.0735369,-.2278917)))
colnames(data.summary) <- c("mean", "lower", "upper")
data.summary$name <- c("ACME", "ADE", "Total")
data.summary$name <- factor(data.summary$name, levels=c("Total", "ADE", "ACME"))


# % of Tot Eff mediated  |  .0026997    

ggplot(data.summary,
       aes(x=mean, y=name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=lower, xmax=upper, height=0.1), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Mediation Analysis: Anger") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Political Engagement") +
  ylab("") +
  scale_x_continuous(limits=c(-6, 2),breaks=seq(-6, 2, by=1)) +
  theme(text = element_text(size=12))


################################################################

#Study 2

#Using results from Stata mediation analysis.


data.summary <- as.data.frame(cbind(c(-.0099696,-.0420683,-.0520379 ),c(-.0250347,-.1186139,-.1301493),c(-.0002367,.0318703, .023396)))
colnames(data.summary) <- c("mean", "lower", "upper")
data.summary$name <- c("ACME", "ADE", "Total")
data.summary$name <- factor(data.summary$name, levels=c("Total", "ADE", "ACME"))


# % of Tot Eff mediated  |  .171504     


ggplot(data.summary,
       aes(x=mean, y=name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=lower, xmax=upper, height=0.1), size=0.6) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Mediation Analysis: Anxiety") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Likelihood of Volunteering") +
  ylab("") +
  scale_x_continuous(limits=c(-.14, .06),breaks=seq(-.14, .06, by=.02)) +
  theme(text = element_text(size=12))



